from typing import List

import numpy as np

from util import LineSegment


class Wall(LineSegment):

    def __init__(self, start_point: List[float], end_point: List[float]):
        super().__init__(np.array(start_point), np.array(end_point))


class Exit:
    def __init__(self, pos: List[float], width: float, num: int):
        self.position: np.ndarray = np.array(pos)
        self.width: float = width
        self.num: int = num


class VerticalModel:
    diw: float
    flg: bool
    niw: np.ndarray
    foot: np.ndarray

    def __init__(self, position: np.ndarray, wall: Wall):
        self.foot = wall.cal_drop_foot_for(position)
        self.flg = wall.cover(self.foot)
        self.diw = np.linalg.norm(self.foot - position)
        self.niw = (self.foot - position) / self.diw
